package happy.diandiankong.api;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.client.JerseyClientConfiguration;
import io.dropwizard.db.DataSourceFactory;
import io.federecio.dropwizard.swagger.SwaggerBundleConfiguration;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * Title.
 * <p>
 * Description.
 *
 * @author Bill Lv {@literal <billcc.lv@hotmail.com>}
 * @version 1.0
 * @since 2016-08-09
 */
public class DDKConfiguration extends Configuration {

    @NotEmpty
    private String defaultName = "Stranger";

    @NotEmpty
    String uploadPath;

    @NotNull
    Double compressRatio;

    @NotEmpty
    String compressTmpPath;

    @NotEmpty
    String domain;

    @Valid
    @NotNull
    private DataSourceFactory database = new DataSourceFactory();

    @Valid
    @NotNull
    private JerseyClientConfiguration jerseyClient = new JerseyClientConfiguration();

    @NotNull
    SwaggerBundleConfiguration swaggerBundleConfiguration;

    @JsonProperty
    public String getDefaultName() {
        return defaultName;
    }

    @JsonProperty
    public void setDefaultName(String defaultName) {
        this.defaultName = defaultName;
    }


    @JsonProperty
    public String getUploadPath() {
        return uploadPath;
    }

    @JsonProperty
    public void setUploadPath(String uploadPath) {
        this.uploadPath = uploadPath;
    }

    @JsonProperty
    public Double getCompressRatio() {
        return compressRatio;
    }

    @JsonProperty
    public void setCompressRatio(Double compressRatio) {
        this.compressRatio = compressRatio;
    }

    @JsonProperty
    public String getCompressTmpPath() {
        return compressTmpPath;
    }

    @JsonProperty
    public void setCompressTmpPath(String compressTmpPath) {
        this.compressTmpPath = compressTmpPath;
    }

    @JsonProperty
    public String getDomain() {
        return domain;
    }

    @JsonProperty
    public void setDomain(String domain) {
        this.domain = domain;
    }

    @JsonProperty("database")
    public DataSourceFactory getDataSourceFactory() {
        return database;
    }

    @JsonProperty("database")
    public void setDataSourceFactory(DataSourceFactory dataSourceFactory) {
        this.database = dataSourceFactory;
    }

    @JsonProperty("jerseyClient")
    public JerseyClientConfiguration getJerseyClientConfiguration() {
        return jerseyClient;
    }

    @JsonProperty("jerseyClient")
    public void setJerseyClientConfiguration(JerseyClientConfiguration jerseyClient) {
        this.jerseyClient = jerseyClient;
    }

    @JsonProperty("swagger")
    public SwaggerBundleConfiguration getSwaggerBundleConfiguration() {
        return swaggerBundleConfiguration;
    }

    @JsonProperty("swagger")
    public void setSwaggerBundleConfiguration(SwaggerBundleConfiguration swaggerBundleConfiguration) {
        this.swaggerBundleConfiguration = swaggerBundleConfiguration;
    }

}
